//
//  TTWindow.m
//  Tint
//
//  Created by Kevin Wu on 2/22/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import "TTWindow.h"

NSString *const TTWindowShakeBeganNotification = @"TTWindowShakeBeganNotification";
NSString *const TTWindowShakeCancelledNotification = @"TTWindowShakeCancelledNotification";
NSString *const TTWindowShakeEndedNotification = @"TTWindowShakeEndedNotification";


@implementation TTWindow


#pragma mark - Accessors

@synthesize broadcastShakeNotification = _broadcastShakeNotification;


#pragma mark - Memory

- (id)init {
    self = [super init];
    if (self) {
        _broadcastShakeNotification = NO;
    }
    return self;
}


#pragma mark - Motion Events

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (_broadcastShakeNotification) {
        [[NSNotificationCenter defaultCenter] postNotificationName:TTWindowShakeBeganNotification object:self];
    }
}

- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (_broadcastShakeNotification) {
        [[NSNotificationCenter defaultCenter] postNotificationName:TTWindowShakeCancelledNotification object:self];
    }
}

- (void)motionEnded:withEvent:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (_broadcastShakeNotification) {
        [[NSNotificationCenter defaultCenter] postNotificationName:TTWindowShakeEndedNotification object:self];
    }
}

@end
